package mitpa.paul.main;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {

	//variables
	Button submit;
	TextView message;
	EditText name;
	Button clear;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //your code here
        
        submit=(Button) findViewById(R.id.button_submit);
        clear=(Button) findViewById(R.id.button_clear);
        message = (TextView) findViewById(R.id.display_textview);
        name = (EditText) findViewById(R.id.name_edittext);
        
        submit.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String temp = name.getEditableText().toString();
				message.setText("Hello "+temp);
				
			}
		});
        clear.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String temp = "";
				message.setText(temp);
				
			}
		});
        
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
